function init() {

  function createMarker(point, color, html) {    
    var mkIcon = new GIcon(G_DEFAULT_ICON);    
    mkIcon.image = 'http://chart.apis.google.com/chart?chst=d_map_pin_icon&chld=bicycle|'+color;
    var marker = new GMarker(point, {icon: mkIcon});
    GEvent.addListener(marker, "click", function() {
      marker.openInfoWindowHtml(html);
    });
    return marker;
  }


  if (GBrowserIsCompatible()) {

    new Ajax.Request('http://openbicing.appspot.com/stations.json', {
    method:'get',
    onSuccess: function(data){
       
       var map = new GMap2(document.getElementById('mapa'));
        map.setCenter(new GLatLng(41.387, 2.170079), 14);
        map.setUIToDefault();
    
       var json = data.responseText.evalJSON();
       
       for (var i = 0; i < json.length; i++) {
         
         var coordinates = json[i].coordinates.split(',');       
         var html = "<b>" + json[i].name + "</b><br /><b>Bicis:</b> " + json[i].bikes + "<br /><b>Huecos:</b> " + json[i].free;
         var color = (json[i].bikes == 0) ? 'CE1616' : '38D03C';
         
         var point = new GLatLng(coordinates[1], coordinates[0]);
          
         map.addOverlay(createMarker(point, color, html));          
         
       };
     }
    });

  };
  
};